fontchooserwidget: scroll to the currently selected row
authorColomban Wendling <ban@herbesfolles.org>
Sun, 16 Sep 2012 17:17:08 +0000 (19:17 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 16 Sep 2012 23:09:45 +0000 (19:09 -0400)
Scroll to the selection when setting it so the selected font is
visible on screen.  This is especially useful if an initial font is
set for the user to see it.

https://bugzilla.gnome.org/show_bug.cgi?id=684156

gtk/gtkfontchooserwidget.c

index d3503fb9d668f5c311cd309eab4da16066beff66..7454a35186a98fa2db42f83a5161f329a69c5cbe 100644 (file)
@@ -1062,7 +1062,13 @@ gtk_font_chooser_widget_ensure_selection (GtkFontChooserWidget *fontchooser)
                                                         &filter_iter,
                                                         &priv->font_iter))
     {
+      GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->filter_model),
+                                                   &filter_iter);
+
       gtk_tree_selection_select_iter (selection, &filter_iter);
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->family_face_list),
+                                    path, NULL, FALSE, 0.0, 0.0);
+      gtk_tree_path_free (path);
     }
   else
     {